package com.xnyzc.lhy.order.feign.fallback.push;

import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.common.penum.EErrorCode;
import com.xnyzc.lhy.order.feign.push.FeignMessageSendService;
import com.xnyzc.lhy.resource.entity.jpush.BizResult;
import com.xnyzc.lhy.resource.entity.jpush.PushInfoEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 服务的降级， 如出现远程调用失败，则会触发该回调
 *
 * @author liuju
 * @since 2019-09-20
 */
@Slf4j
@Service
public class FeignMessageSendServiceFallback implements FeignMessageSendService {

    @Override
    public BizResult pushMessage(PushInfoEntity pushInfoEntity) {
        BizResult bizResult = new BizResult();
        bizResult.setCode(EErrorCode.jPushSendError.getValue());
        bizResult.setMsg(EErrorCode.jPushSendError.getDesc());
        log.info("极光推送服务间调用失败");
        return bizResult;
    }

    @Override
    public Rv getFileUrl(Long fileId) {
        log.error("fegin图片获取失败");
        return Rv.wrap(EErrorCode.unData, "");
    }
}
